package com.dx.architectureddd.app.chain.init;

import com.dx.architectureddd.common.dp.pipeline.ContextHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 等级初始化
 *
 * @author xin.deng
 * @date 2023/09/24
 */
@Slf4j
@Component
public class LevelInit implements ContextHandler<InitContext> {
    @Override
    public boolean handle(InitContext context) {
        Map<String, Object> inPut = context.getInPut();
        String level = (String) inPut.get("level");
        if (level.compareTo("100") >= 0) {
            log.info("角色等级为{}", level);
            inPut.put("monster", "哥斯拉");
            return true;
        }
        return false;
    }
}
